/**
 * @Author: lusx
 * @Date:   21-03-2019 02:54:50
 * @Project: Govern督办
 * @Last modified by:   lusx
 * @Last modified time: 25-03-2019 11:28:50
 */
import React from "react";
import { observer, inject } from "mobx-react";
import { withRouter } from "react-router-dom";
import { Tools, Select, TimeRangePicker } from "weaver-mobile";
import { BrowserHrm } from "weaver-mobile-page";
import HocRouteLayout from "../../../governTools/hocs/hocRouteLayout";
const getLabel = Tools.getLabel;
@inject("othersStore")
@withRouter
@observer
@HocRouteLayout
export default class InfoSearch extends React.Component {
  constructor(props) {
    super(props);
    this.labelPers = {
      document: getLabel("388369,127", "成文人")
    };
    this.labelTime = {
      document: getLabel("388369,19736", "成文时间")
    };
    this.state = {
      selectkey: ""
    };
  }
  render() {
    const {
      othersStore: {
        browserHrm,
        setReporter,
        pageKey,
        selectOptions,
        setReportDate_select,
        sertReportDate
      }
    } = this.props;
    return (
      <div className="g-infoSearch">
        <BrowserHrm
          label={this.labelPers[pageKey]}
          store={browserHrm}
          hasAdvanceSerach
          isSingle={false}
          type={1}
          onChange={(value, valueSpan, valueArray) => {
            setReporter(value);
          }}
        />
        <Select
          value={"9"}
          label={this.labelTime[pageKey]}
          options={selectOptions}
          onChange={(key, showname) => {
            this.setState({
              selectkey: key
            });
            setReportDate_select(key);
          }}
        />
        {this.state.selectkey === "8" && (
          <div class="am-list-form line border">
            <div class="am-list-label">{getLabel("555", "指定日期范围")}</div>
            <div class="am-list-content ">
              <TimeRangePicker
                mode="date"
                placeholder={getLabel("555", "请选择")}
                value={[]}
                onChange={v => sertReportDate(v)}
              />
            </div>
          </div>
        )}
      </div>
    );
  }
}
